import Dexie from 'dexie';

export const db = new Dexie('myDatabase');

db.version(1).stores({
  save: '&name, content',
});

export const saveToDb = (name, content) => {
  return db.save.put({name, content});
};

export const loadFromDb = (name) => {
  return db.save.get({name});
};

export const listSaves = () => {
  return db.save.toArray();
};
